package cn.supermaster.management.web.controller.system;

import cn.supermaster.management.web.service.system.ISMenuService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import cn.supermaster.management.common.controller.BaseController;

/**
 * All rights Reserved, Designed By www.super-bytecode.com
 *
 * @ProjectName: supermaster-management
 * @Package: cn.supermaster.management.web.rest.system
 * @ClassName: SystemMenuRestController
 * @Description: [菜单信息]
 * <p> </p>
 * @Author: [Lance Ting]
 * @Date: 2021/1/12 0:34
 * @Version: V1.0
 * @Copyright: 2021 www.super-bytecode.comn Inc. All rights reserved.
 * TODO: 注意,本文件Lance Ting所作,如果转载或使用请标明具体出处!
 **/
@Controller
@RequestMapping("/system/menu")
public class SystemMenuController extends BaseController {

    @Autowired
    private ISMenuService menuService;

    @RequiresPermissions("system:menu:view")
    @GetMapping()
    public String skipMenuIndexHtml() {
        return menuService.skipMenuIndexHtml();
    }

    /**
     * 新增界面
     */
    @GetMapping("/add/{parentId}")
    public String skipAddMenuHtml(@PathVariable("parentId") Long parentId, ModelMap modelMap) {
        return menuService.skipAddMenuHtml(modelMap, parentId);
    }

    /**
     * 修改菜单
     */
    @GetMapping("/edit/{menuId}")
    public String skipModifyMenuHtml(@PathVariable("menuId") Long menuId, ModelMap modelMap) {
        return menuService.skipModifyMenuHtml(modelMap, menuId);
    }

    /**
     * 选择菜单图标
     */
    @GetMapping("/icon")
    public String skipMenuIconHtml() {
        return menuService.skipMenuIconHtml();
    }

    /**
     * 选择菜单树
     */
    @GetMapping("/selectMenuTree/{menuId}")
    public String skipSelectMenuTreeHtml(@PathVariable("menuId") Long menuId, ModelMap modelMap) {
        return menuService.skipSelectMenuTreeHtml(modelMap, menuId);
    }
}